package com.bw.module_mine.model.repository

import com.bw.module_mine.model.api.MineApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import javax.inject.Inject

class MineRepository @Inject constructor(private val mineApi: MineApi){

    fun login(username:String,password:String) = flow {
        emit(mineApi.login(username,password))
    }.flowOn(Dispatchers.IO)


    fun register(username:String,password:String) = flow {
        emit(mineApi.register(username,password))
    }.flowOn(Dispatchers.IO)

    fun getAccount(userid:Int) = flow {
        emit(mineApi.getAccount(userid))
    }.flowOn(Dispatchers.IO)
}